package com.lvtulife.paas.gtd;

import com.baomidou.mybatisplus.annotations.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.ConfigBaseEntity;
import com.baomidou.mybatisplus.generator.ConfigGenerator;

/**
 * Created by Administrator on 2016/10/24 0024.
 */
public class CustomGenerator {
    public static void main(String[] args) {
        ConfigGenerator cg = new ConfigGenerator();
        // 配置 MySQL 连接
        cg.setDbDriverName("com.mysql.jdbc.Driver");
        cg.setDbUser("root");
        cg.setDbPassword("root");
        cg.setDbUrl("jdbc:mysql://192.168.199.244:3306/lvtulife-paas?characterEncoding=utf8");
        // 配置包名
        cg.setEntityPackage("com.lvtulife.paas.gtd.entity");
        cg.setMapperPackage("com.lvtulife.paas.gtd.mapper");
        cg.setServicePackage("com.lvtulife.paas.gtd.service");
        cg.setServiceName("%sServiceI");
        cg.setXmlPackage("com.lvtulife.paas.gtd.mapper.xml");
        cg.setServiceImplPackage("com.lvtulife.paas.gtd.service.impl");
        cg.setSuperService("com.lvtulife.common.service.BaseServiceI");
        cg.setSuperServiceImpl("com.lvtulife.common.service.impl.BaseServiceImpl");

        ConfigBaseEntity configBaseEntity = new ConfigBaseEntity();
        configBaseEntity.setPackageName("com.lvtulife.common.entity");
        configBaseEntity.setClassName("BaseEntity");
        configBaseEntity.setColumns(new String[]{"id"});
        cg.setConfigBaseEntity(configBaseEntity);



        cg.setTableNames(new String[]{"gtd_affair",
                "gtd_affair_stats",
                "gtd_aim",
                "gtd_aim_branch",
                "gtd_aim_branch_assess",
                "gtd_aim_trunk",
                "gtd_aim_trunk_reward",
                "gtd_aim_type",
                "gtd_calendar",
                "gtd_habit",
                "gtd_habit_remind",
                "gtd_habit_rule",
                "gtd_habit_sign",
                "gtd_ideal",
                "gtd_ideal_adjust",
                "gtd_ideal_oplog",
                "gtd_init_params",
                "gtd_memos",
                "gtd_memos_group",
                "gtd_pool",
                "gtd_pool_his",
                "gtd_pool_temp",
                "gtd_strategy",
                "gtd_strategy_sum",
                "gtd_strategy_theme",
                "gtd_temp",
                "gtd_week_plan",
                "gtd_week_stats"
        });

        // 配置表主键策略
        cg.setIdType(IdType.ID_WORKER);
        // 设置数据库是否为下划线
        cg.setDbColumnUnderline(true);
        // 是否覆盖当前已有文件（true为覆盖，false为不覆盖）
        cg.setFileOverride(true);
        // 配置保存路径
        cg.setSaveDir("/workSpaces/develop/lvtulife-home/lvtulife-paas/ltu-service-gtd/src/main/java");
        //cg.setSaveDir("/lvtulife-work/lvtulife-paas/ltu-service-gtd/src/main/java");
        // 其他参数请根据上面的参数说明自行配置，当所有配置完善后，运行AutoGenerator.run()方法生成Code
        // 生成代码
        AutoGenerator.run(cg);
    }
}
